#pragma once

#include <vector>
#include <rtc_base/ip_address.h>

namespace xrtc {

// 可用网络信息地址
class Network {
public:
    Network(const std::string& name, const rtc::IPAddress& ip) : m_name(name), m_ip(ip) {}
    ~Network() = default;

    const std::string& getName() const { return m_name; }
    const rtc::IPAddress& getIP() const { return m_ip; }

    std::string toString() const {  
        return m_name + ":" + m_ip.ToString();
    }

private:
    std::string m_name;
    rtc::IPAddress m_ip;
};

class NetworkManager {
public:
    NetworkManager() = default;
    ~NetworkManager();

    const std::vector<Network*>& getNetworks() const { return m_network_list; }

    // 获取网卡中可用ip地址
    int create_networks();

private:
    std::vector<Network*> m_network_list;
};

}